﻿/*****************************************************************//**
 * @file    FITKOCCGraphObjectDatum.h
 * @brief   Graph object for datum.
 *
 * @author  ChengHaotian (yeguangbaozi@foxmail.com)
 * @date    2024-08-30
 *********************************************************************/

#ifndef __FITKOCCGRAPHOBJECTDATUM_H__
#define __FITKOCCGRAPHOBJECTDATUM_H__

#include "FITKOCCGraphObject3D.h"

#include "FITKOCCGraphAdaptorAPI.h"

#include <QColor>

 // Forward declaration
class QVariant;

namespace Interface
{
    class FITKAbsGeoDatum;
}

namespace Exchange
{
    /**
     * @brief   Graph object for TopoDS_Shape and OCC graph widget.
     * @author  ChengHaotian (yeguangbaozi@foxmail.com)
     * @date    2024-08-30
     */
    class FITKOCCGRAPHADAPTORAPI FITKOCCGraphObjectDatum : public FITKOCCGraphObject3D
    {
        // Regist
        FITKGraphObjectRegist(FITKOCCGraphObjectDatum, FITKOCCGraphObject3D);
        FITKCLASS(Exchange, FITKOCCGraphObjectDatum);

    public:
        /**
         * @brief   Constructor.
         * @param   datumData: The datum data object
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-08-30
         */
        FITKOCCGraphObjectDatum(Interface::FITKAbsGeoDatum* datumData);

        /**
         * @brief   Destructor.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-06
         */
        ~FITKOCCGraphObjectDatum();

        /**
         * @brief   Update the graph object.[override]
         * @param   forceUpdate: Force update[default]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-08-06
         */
        void update(bool forceUpdate = false) override;

        /**
         * @brief   Change the view mode by the type value only.[override]
         * @param   type: The shape type
         * @param   visible: The visibility[UNUSED]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-09-04
         */
        void setViewMode(FITKOCCCommons::ShapeMeshViewMode type, bool visible = true) override;

        /**
         * @brief   Update the interactive objects in graph object.[override]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-08-09
         */
        void updateInteractiveObjs() override;

        /**
         * @brief   Set the color to all vertice, edges and faces.[override]
         * @param   color: The color
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-13
         */
        void setColor(QColor color) override;

        /**
         * @brief   Enable or disable transparency.[override]
         * @param   isOn: Enable or not
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-08-05
         */
        void setEnableTransparency(bool isOn) override;

        /**
         * @brief   Set the line width of the edges( wire ).[override]
         * @param   size
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-08-20
         */
        void setLineWidth(double size) override;

        /**
         * @brief   Highlight the whole object.[override]
         * @param   update: Need to update the view[default]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-08-07
         */
        void highlight(bool update = true) override;

        /**
         * @brief   Dis-highlight the object.[override]
         * @param   update: Need to update the view[default]
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-08-07
         */
        void disHighlight(bool update = true) override;

    protected:
        /**
         * @brief   Constructor.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-06
         */
        FITKOCCGraphObjectDatum() = default;

    private:
        /**
         * @brief   Generate the AIS_Shape with the TopoDS_Shape data.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-06-12
         */
        void generateShape();

    private:
        /**
         * @brief   The interactive object of the datum.
         * @author  ChengHaotian (yeguangbaozi@foxmail.com)
         * @date    2024-08-30
         */
        AIS_InteractiveObject* m_aisObj{ nullptr };

    };
}   // namespace Exchange

#endif // __FITKOCCGRAPHOBJECTDATUM_H__
